package com.j283_5.wisdom_park.vo.warning_management;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.j283_5.wisdom_park.pojo.Warning;
import com.j283_5.wisdom_park.pojo.WarningDelivery;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.sql.Timestamp;


/**
 * @author shkstart
 * @create 2022-05-06-9:21
 */

@NoArgsConstructor
@AllArgsConstructor
@ToString
public class WarningDeliveryVo implements Serializable {
    /**
     * 预警记录id
     */
    @TableId(value = "wrec_id", type = IdType.AUTO)
    private Integer wrecId;
    /**
     * 设备名称
     */
    private String ddetName;
    /**
     * 设备编号
     */
    private String ddetNumber;
    /**
     * 0:告警事件,1:设备故障
     */
    private String wrecTypestate;
    /**
     * 预警时间
     */
    private Timestamp wrecDate;
    /**
     * 0:未派单,1:已派单,2:已处理
     */
    private String wrecState;
    /**
     * 跟进人
     */
    private String adminName;
    /**
     * 跟进人电话
     */
    private String adminPhone;

    /**
     * 处理结果
     */
    private String wrecResult;

    /**
     * 维护前现场照片
     */
    private String wrecLivephotostart;
    /**
     * 维护后现场照片
     */
    private String wrecLivephotoend;



    /**
     * 安装位置
     */
    private String dinfLocation;
    /**
     * 预警内容
     */
    private String wrecContent;

    /**
     * 持续时间
     */
    private Timestamp wrecDuration;
    /**
     * 设备型号
     */
    private String ddetType;

    /**
     * 设备厂家
     */
    private String ddetFactory;
    /**
     * 出场时间
     */
    private Timestamp ddetFactorydate;
    /**
     * 产品版本
     */
    private String ddetVersion;



    public WarningDeliveryVo(WarningDelivery warningDelivery){
        this.ddetName = warningDelivery.getDdetName();
        this.ddetNumber = warningDelivery.getDdetNumber();
        this.dinfLocation = warningDelivery.getDinfLocation();
        this.wrecId = warningDelivery.getWrecId();
        this.wrecContent = warningDelivery.getWrecContent();
        this.wrecDate = warningDelivery.getWrecDate();
        if (warningDelivery.getWrecTypestate() != null){
            setWrecTypestate(warningDelivery.getWrecTypestate());
        }
        if (warningDelivery.getWrecState() != null){
            setWrecState(warningDelivery.getWrecState());
        }
        if (warningDelivery.getAdminName() != null) {
            this.adminName = warningDelivery.getAdminName();
        }
        if (warningDelivery.getAdminPhone() != null) {
            this.adminPhone = warningDelivery.getAdminPhone();
        }
        if (warningDelivery.getWrecResult() != null){
            this.wrecResult = warningDelivery.getWrecResult();
        }
        if (warningDelivery.getWrecLivephotoend() != null){
            this.wrecLivephotoend = warningDelivery.getWrecLivephotoend();
        }
        if (warningDelivery.getWrecLivephotostart() != null){
            this.wrecLivephotostart = warningDelivery.getWrecLivephotostart();
        }
        this.wrecDuration = warningDelivery.getWrecDuration();
        this.ddetType = warningDelivery.getDdetType();
        this.ddetFactory = warningDelivery.getDdetFactory();
        this.ddetFactorydate = warningDelivery.getDdetFactorydate();
        this.ddetVersion = warningDelivery.getDdetVersion();
    }
    public String getWrecLivephotostart() {
        return wrecLivephotostart;
    }

    public void setWrecLivephotostart(String wrecLivephotostart) {
        this.wrecLivephotostart = wrecLivephotostart;
    }

    public String getWrecLivephotoend() {
        return wrecLivephotoend;
    }

    public void setWrecLivephotoend(String wrecLivephotoend) {
        this.wrecLivephotoend = wrecLivephotoend;
    }
    public Integer getWrecId() {
        return wrecId;
    }

    public void setWrecId(Integer wrecId) {
        this.wrecId = wrecId;
    }

    public String getDdetName() {
        return ddetName;
    }

    public void setDdetName(String ddetName) {
        this.ddetName = ddetName;
    }

    public String getDdetNumber() {
        return ddetNumber;
    }

    public void setDdetNumber(String ddetNumber) {
        this.ddetNumber = ddetNumber;
    }

    public String getWrecTypestate() {
        return wrecTypestate;
    }

    public void setWrecTypestate(String wrecTypestate) {
        this.wrecTypestate = wrecTypestate;
    }

    public Timestamp getWrecDate() {
        return wrecDate;
    }

    public void setWrecDate(Timestamp wrecDate) {
        this.wrecDate = wrecDate;
    }

    public String getWrecState() {
        return wrecState;
    }

    public void setWrecState(String wrecState) {
        this.wrecState = wrecState;
    }

    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    public String getAdminPhone() {
        return adminPhone;
    }

    public void setAdminPhone(String adminPhone) {
        this.adminPhone = adminPhone;
    }

    public String getWrecResult() {
        return wrecResult;
    }

    public void setWrecResult(String wrecResult) {
        this.wrecResult = wrecResult;
    }


    public String getDinfLocation() {
        return dinfLocation;
    }

    public void setDinfLocation(String dinfLocation) {
        this.dinfLocation = dinfLocation;
    }

    public String getWrecContent() {
        return wrecContent;
    }

    public void setWrecContent(String wrecContent) {
        this.wrecContent = wrecContent;
    }

    public Timestamp getWrecDuration() {
        return wrecDuration;
    }

    public void setWrecDuration(Timestamp wrecDuration) {
        this.wrecDuration = wrecDuration;
    }

    public String getDdetType() {
        return ddetType;
    }

    public void setDdetType(String ddetType) {
        this.ddetType = ddetType;
    }

    public String getDdetFactory() {
        return ddetFactory;
    }

    public void setDdetFactory(String ddetFactory) {
        this.ddetFactory = ddetFactory;
    }

    public Timestamp getDdetFactorydate() {
        return ddetFactorydate;
    }

    public void setDdetFactorydate(Timestamp ddetFactorydate) {
        this.ddetFactorydate = ddetFactorydate;
    }

    public String getDdetVersion() {
        return ddetVersion;
    }

    public void setDdetVersion(String ddetVersion) {
        this.ddetVersion = ddetVersion;
    }

    public void setWrecTypestate(Integer wrecTypestate){
        switch (wrecTypestate){
            case 0:
                this.wrecTypestate = "告警事件";
                return;
            case 1:
                this.wrecTypestate = "设备故障";
                return;
            default:
                this.wrecTypestate = "告警事件";
        }
    }

    public void setWrecState(Integer wrecState){
        switch (wrecState){
            case 0:
                this.wrecState = "未派单";
                return;
            case 1:
                this.wrecState = "已派单";
                return;
            case 2:
                this.wrecState = "已处理";
                return;
            default:
                this.wrecState = "未派单";
        }
    }
}
